/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Clases;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Bryan
 */
@Entity
@Table(name = "nota")
@NamedQueries({
    @NamedQuery(name = "Nota.findAll", query = "SELECT n FROM Nota n"),
    @NamedQuery(name = "Nota.findByIdNota", query = "SELECT n FROM Nota n WHERE n.idNota = :idNota"),
    @NamedQuery(name = "Nota.findByActividad", query = "SELECT n FROM Nota n WHERE n.actividad = :actividad"),
    @NamedQuery(name = "Nota.findByDescripci\u00f3n", query = "SELECT n FROM Nota n WHERE n.descripci\u00f3n = :descripci\u00f3n"),
    @NamedQuery(name = "Nota.findByNotaNeta", query = "SELECT n FROM Nota n WHERE n.notaNeta = :notaNeta"),
    @NamedQuery(name = "Nota.findByNotaPorcentual", query = "SELECT n FROM Nota n WHERE n.notaPorcentual = :notaPorcentual"),
    @NamedQuery(name = "Nota.findByFecha", query = "SELECT n FROM Nota n WHERE n.fecha = :fecha")})
public class Nota implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idNota")
    private Short idNota;
    @Basic(optional = false)
    @Column(name = "Actividad")
    private String actividad;
    @Basic(optional = false)
    @Column(name = "Descripci\u00f3n")
    private String descripción;
    @Basic(optional = false)
    @Column(name = "NotaNeta")
    private String notaNeta;
    @Basic(optional = false)
    @Column(name = "NotaPorcentual")
    private String notaPorcentual;
    @Basic(optional = false)
    @Column(name = "Fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @JoinColumn(name = "idCursoUnidad", referencedColumnName = "idCursoUnidad")
    @ManyToOne(optional = false)
    private Cursounidad cursounidad;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nota")
    private Collection<Alumnonota> alumnonotaCollection;

    public Nota() {
    }

    public Nota(Short idNota) {
        this.idNota = idNota;
    }

    public Nota(Short idNota, String actividad, String descripción, String notaNeta, String notaPorcentual, Date fecha) {
        this.idNota = idNota;
        this.actividad = actividad;
        this.descripción = descripción;
        this.notaNeta = notaNeta;
        this.notaPorcentual = notaPorcentual;
        this.fecha = fecha;
    }

    public Short getIdNota() {
        return idNota;
    }

    public void setIdNota(Short idNota) {
        this.idNota = idNota;
    }

    public String getActividad() {
        return actividad;
    }

    public void setActividad(String actividad) {
        this.actividad = actividad;
    }

    public String getDescripción() {
        return descripción;
    }

    public void setDescripción(String descripción) {
        this.descripción = descripción;
    }

    public String getNotaNeta() {
        return notaNeta;
    }

    public void setNotaNeta(String notaNeta) {
        this.notaNeta = notaNeta;
    }

    public String getNotaPorcentual() {
        return notaPorcentual;
    }

    public void setNotaPorcentual(String notaPorcentual) {
        this.notaPorcentual = notaPorcentual;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Cursounidad getCursounidad() {
        return cursounidad;
    }

    public void setCursounidad(Cursounidad cursounidad) {
        this.cursounidad = cursounidad;
    }

    public Collection<Alumnonota> getAlumnonotaCollection() {
        return alumnonotaCollection;
    }

    public void setAlumnonotaCollection(Collection<Alumnonota> alumnonotaCollection) {
        this.alumnonotaCollection = alumnonotaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idNota != null ? idNota.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Nota)) {
            return false;
        }
        Nota other = (Nota) object;
        if ((this.idNota == null && other.idNota != null) || (this.idNota != null && !this.idNota.equals(other.idNota))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "escuela.Nota[idNota=" + idNota + "]";
    }

}
